﻿Public MustInherit Class View

	Public List As ListBox
	Public Key As String

	MustOverride Sub Run()
	MustOverride Sub Tapped(ByVal Key As String)

	Overridable Sub Draw(ByVal e As ListBox.ListBoxDrawItemEventArgs)
		Dim R = e.Rect
		For i = 1 To 12
			Dim Pen As New Pen(Color.Black.Opacity(192 / (i ^ 2)), i)
			e.Graphics.DrawRoundRect(R, Pen, 12)
		Next
		R = e.Rect
		R.Inflate(1, 1)
		e.Graphics.FillRoundRect(e.Rect, LGBv(R, Color.White, Color.SkyBlue), 12)
		e.Rect.Inflate(-1, -1)
		e.Graphics.FillRoundRect(e.Rect, LGBv(R, Color.SkyBlue, Color.White), 10)
		e.Rect.Inflate(-2, -2)
		R = e.Rect
		R.Height \= 2
		e.Graphics.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBilinear
		R.Inflate(-R.Width / 8, -R.Height / 8)
		R.Inflate(-(R.Width - R.Height) / 2, 0)
		R.Offset(0, R.Height / 8)
		If Not e.Item.Image Is Nothing Then e.Graphics.DrawImage(e.Item.Image, R)
		R = e.Rect
		R.Height \= 2
		R.Offset(0, R.Height)
		'e.Graphics.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
		DrawText(e.Graphics, e.Item.Text, New Font(Font.Name, R.Height \ 5, FontStyle.Bold), R, Color.Black, "cmw")
	End Sub

	ReadOnly Property Font As Font
		Get
			Return List.Font
		End Get
	End Property

End Class
